package com.baobaotao.web;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.MatrixVariable;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.servlet.ModelAndView;

import com.baobaotao.domain.User;

@Controller
@RequestMapping("/abc")
public class UserController {
    @RequestMapping(value = "/register/{v1}")
    public String register(@PathVariable String v1, @MatrixVariable(value = "q") int q) {
        System.out.println("v1=" + v1 + ", q=" + q);
        return "user/register";
    }

    @RequestMapping(value = "/kkk", method = RequestMethod.POST)
    public ModelAndView createUser(User user) {
        System.out.println(user.getUserName());
        ModelAndView mav = new ModelAndView();
        mav.setViewName("user/createSuccess");
        mav.addObject("userobj", user);
        return mav;
    }
}
